package com.rdzn.mall.center.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.rdzn.mall.center.entity.PmsBrand;
import com.rdzn.mall.center.mapper.PmsBrandMapper;
import com.rdzn.mall.center.service.IPmsBrandService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: pms_brand
 * @Author: jeecg-boot
 * @Date:   2020-08-27
 * @Version: V1.0
 */
@DS("mall")
@Service
public class PmsBrandServiceImpl extends ServiceImpl<PmsBrandMapper, PmsBrand> implements IPmsBrandService {

    @Override
    public List<PmsBrand> getBrandByIds(List<Integer> ids) {
        return list(new LambdaQueryWrapper<PmsBrand>()
                .in(PmsBrand::getId, ids)
                .eq(PmsBrand::getShowStatus, 1)
                .orderByDesc(PmsBrand::getSort)
                .last("limit 4")
        );
    }
}
